home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / uemlsrc.arc / ed.h < prev    next >
Text File  |  1987-08-24  |  13KB  |  229 lines

  1. /*
  2.  * This file is the general header file for
  3.  * all parts of the MicroEMACS display editor. It contains
  4.  * definitions used by everyone, and it contains the stuff
  5.  * you have to edit to create a version of the editor for
  6.  * a specific operating system and terminal.
  7.  */
  8. #define V7      0                       /* V7 UN*X or Coherent          */
  9. #define VMS     0                       /* VAX/VMS                      */
  10. #define CPM     0                       /* CP/M-86                      */
  11. #define ST      1
  12. #define ALCYON  1                       /* Alcyon C compiler            */
  13. #define MSDOS   0                       /* MS-DOS                       */
  14.  
  15. #define ANSI    0
  16. #define ADM3    0                       /* [Kaypro] Lear Siegler        */
  17. #define VT52    0                       /* VT52 terminal (Zenith).      */
  18. #define VT100   0                       /* Handle VT100 style keypad.   */
  19. #define LK201   0                       /* Handle LK201 style keypad.   */
  20. #define RAINBOW 0                       /* Use Rainbow fast video.      */
  21. #define TERMCAP 0                       /* Use TERMCAP                  */
  22.  
  23. #define CVMVAS  1                       /* C-V, M-V arg. in screens.    */
  24.  
  25. #define NFILEN  80                      /* # of bytes, file name        */
  26. #define NBUFN   16                      /* # of bytes, buffer name      */
  27. #define NLINE   256                     /* # of bytes, line             */
  28. #define NKBDM   256                     /* # of strokes, keyboard macro */
  29. #define NPAT    80                      /* # of bytes, pattern          */
  30. #define HUGE    1000                    /* Huge number                  */
  31.  
  32. #define AGRAVE  0x60                    /* M- prefix,   Grave (LK201)   */
  33. #define METACH  0x1B                    /* M- prefix,   Control-[, ESC  */
  34. #define CTMECH  0x1C                    /* C-M- prefix, Control-\       */
  35. #define EXITCH  0x1D                    /* Exit level,  Control-]       */
  36. #define CTRLCH  0x1E                    /* C- prefix,   Control-^       */
  37. #define HELPCH  0x1F                    /* Help key,    Control-_       */
  38.  
  39. #define CTRL    0x0100                  /* Control flag, or'ed in       */
  40. #define META    0x0200                  /* Meta flag, or'ed in          */
  41. #define CTLX    0x0400                  /* ^X flag, or'ed in            */
  42. #define SPEC    0x0800                  /* Special scancode keys        */
  43.  
  44. #define MAYBE   -1                      /* Conditional based on query   */
  45. #define FALSE   0                       /* False, no, bad, etc.         */
  46. #define TRUE    1                       /* True, yes, good, etc.        */
  47. #define ABORT   2                       /* Death, ^G, abort, etc.       */
  48.  
  49. #define FIOSUC  0                       /* File I/O, success.           */
  50. #define FIOFNF  1                       /* File I/O, file not found.    */
  51. #define FIOEOF  2                       /* File I/O, end of file.       */
  52. #define FIOERR  3                       /* File I/O, error.             */
  53.  
  54. #define CFCPCN  0x0001                  /* Last command was C-P, C-N    */
  55. #define CFKILL  0x0002                  /* Last command was a kill      */
  56.  
  57. #define PRNRDY  gemdos(0x11)            /* LST: status for print buffer */
  58. /*
  59.  * There is a window structure allocated for
  60.  * every active display window. The windows are kept in a
  61.  * big list, in top to bottom screen order, with the listhead at
  62.  * "wheadp". Each window contains its own values of dot and mark.
  63.  * The flag field contains some bits that are set by commands
  64.  * to guide redisplay; although this is a bit of a compromise in
  65.  * terms of decoupling, the full blown redisplay is just too
  66.  * expensive to run for every input character.
  67.  */
  68. typedef struct  WINDOW {
  69.         struct  WINDOW *w_wndp;         /* Next window                  */
  70.         struct  BUFFER *w_bufp;         /* Buffer displayed in window   */
  71.         struct  LINE *w_linep;          /* Top line in the window       */
  72.         struct  LINE *w_dotp;           /* Line containing "."          */
  73.         short   w_doto;                 /* Byte offset for "."          */
  74.         struct  LINE *w_markp;          /* Line containing "mark"       */
  75.         short   w_marko;                /* Byte offset for "mark"       */
  76.         char    w_toprow;               /* Origin 0 top row of window   */
  77.         char    w_ntrows;               /* # of rows of text in window  */
  78.         char    w_force;                /* If NZ, forcing row.          */
  79.         char    w_flag;                 /* Flags.                       */
  80. }       WINDOW;
  81.  
  82. #define WFFORCE 0x01                    /* Window needs forced reframe  */
  83. #define WFMOVE  0x02                    /* Movement from line to line   */
  84. #define WFEDIT  0x04                    /* Editing within a line        */
  85. #define WFHARD  0x08                    /* Better to a full display     */
  86. #define WFMODE  0x10                    /* Update mode line.            */
  87.  
  88. /*
  89.  * Text is kept in buffers. A buffer header, described
  90.  * below, exists for every buffer in the system. The buffers are
  91.  * kept in a big list, so that commands that search for a buffer by
  92.  * name can find the buffer header. There is a safe store for the
  93.  * dot and mark in the header, but this is only valid if the buffer
  94.  * is not being displayed (that is, if "b_nwnd" is 0). The text for
  95.  * the buffer is kept in a circularly linked list of lines, with
  96.  * a pointer to the header line in "b_linep".
  97.  */
  98. typedef struct  BUFFER {
  99.         struct  BUFFER *b_bufp;         /* Link to next BUFFER          */
  100.         struct  LINE *b_dotp;           /* Link to "." LINE structure   */
  101.         short   b_doto;                 /* Offset of "." in above LINE  */
  102.         struct  LINE *b_markp;          /* The same as the above two,   */
  103.         short   b_marko;                /* but for the "mark"           */
  104.         struct  LINE *b_linep;          /* Link to the header LINE      */
  105.         char    b_nwnd;                 /* Count of windows on buffer   */
  106.         char    b_flag;                 /* Flags                        */
  107.         char    b_bmode;                /* This buffer's current modes  */
  108.         char    b_fname[NFILEN];        /* File name                    */
  109.         char    b_bname[NBUFN];         /* Buffer name                  */
  110. }       BUFFER;
  111.  
  112. #define BFTEMP  0x01                    /* Internal temporary buffer    */
  113. #define BFCHG   0x02                    /* Changed since last write     */
  114. #define BMNWRAP 0x0001                  /* Buffer is in No-Wrap mode    */
  115. #define BMWRAP  0x0002                  /* Buffer is in Wrap mode       */
  116. #define BMCMODE 0x0004                  /* Buffer is in C-Mode          */
  117. #define NUMMODES 3
  118.  
  119. /*
  120.  * The starting position of a
  121.  * region, and the size of the region in
  122.  * characters, is kept in a region structure.
  123.  * Used by the region commands.
  124.  */
  125. typedef struct  {
  126.         struct  LINE *r_linep;          /* Origin LINE address.         */
  127.         short   r_offset;               /* Origin LINE offset.          */
  128.         short   r_size;                 /* Length in characters.        */
  129. }       REGION;
  130.  
  131. /*
  132.  * All text is kept in circularly linked
  133.  * lists of "LINE" structures. These begin at the
  134.  * header line (which is the blank line beyond the
  135.  * end of the buffer). This line is pointed to by
  136.  * the "BUFFER". Each line contains a the number of
  137.  * bytes in the line (the "used" size), the size
  138.  * of the text array, and the text. The end of line
  139.  * is not stored as a byte; it's implied. Future
  140.  * additions will include update hints, and a
  141.  * list of marks into the line.
  142.  */
  143. typedef struct  LINE {
  144.         struct  LINE *l_fp;             /* Link to the next line        */
  145.         struct  LINE *l_bp;             /* Link to the previous line    */
  146.         short   l_size;                 /* Allocated size               */
  147.         short   l_used;                 /* Used size                    */
  148.         char    l_text[];               /* A bunch of characters.       */
  149. }       LINE;
  150.  
  151. #define lforw(lp)       ((lp)->l_fp)
  152. #define lback(lp)       ((lp)->l_bp)
  153. #define lgetc(lp, n)    ((lp)->l_text[(n)]&0xFF)
  154. #define lputc(l